Skip to content

ref(egress): simplify host installation credential cache - #1700

Merged
dcramer merged 8 commits into
mainfrom
ref/simplify-egress-installation-credentials
Aug 26, 2026
Merged

ref(egress): simplify host installation credential cache#1700
dcramer merged 8 commits into
mainfrom
ref/simplify-egress-installation-credentials

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Recovers the unfinished work from the mid-PR push thread.

Problem
Intermittent GitHub receive-pack 403s after a good installation-token mint looked like Junior lost App write access mid-PR. The lease cache was also keyed by sandbox egressId + contextId and repository lease scope, so each new sandbox minted tokens too often and made the failure more likely.

Change
Keep the real security boundary: the sandbox never sees tokens; host egress injects them.

Simplify the machinery around it:

  • cache installation leases on the host by provider + grant (shared across sandboxes)
  • keep user and broker grants bound to the actor
  • stop repository filters on installation-write token mint bodies (use full installed App permissions; repo allowlist stays policy and install scope)
  • refresh cached leases 5 minutes before expiry
  • on upstream 403 after injection: clear lease → issue a new token → retry once, then record permission denied

Supersedes the narrower retry-only draft in #1694.

Thread: https://sentry.slack.com/archives/C0AHB7N2JCR/p1787690872538269

Requested by David Cramer.

--

View Junior Session [Sentry]

Keep sandbox isolation via host injection, but stop minting and caching
installation tokens per sandbox context or repository lease scope. Share
installation leases on the host, refresh before expiry, and remint once on
upstream 403 so mid-PR pushes no longer look like lost App write access.

Co-Authored-By: David Cramer <david@sentry.io>
@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview Aug 26, 2026 2:59am

Request Review

Rewrite comments, docs, and test titles in plain language. Drop leftover
repository-scoped wording and other internal slang from the simplification.

Co-Authored-By: David Cramer <david@sentry.io>
Keep hard rules and tool routing in SKILL.md. Move edit/PR packaging,
command matrices, and troubleshooting into references so every run does
not load the full handbook.

Co-Authored-By: David Cramer <david@sentry.io>
sentry-junior Bot and others added 2 commits August 26, 2026 02:39
Agent display name is configurable. Prefer runtime/bot wording in skill
text, and keep protocol tokens like junior-auth-required unchanged.

Co-Authored-By: David Cramer <david@sentry.io>
Agent display name is configurable. Prefer runtime/bot wording in skills
and tool descriptions/errors. Keep protocol tokens and session footer
product links unchanged.

Co-Authored-By: David Cramer <david@sentry.io>
Keep the tool-error classification baseline in sync with the agent-name
neutral create issue/PR failure messages.
Remove dead review-thread repo-ref validation, skip the second-pass host
transform recheck on 403 retry, and neutralize remaining agent-branded
permission-denied copy.

Co-Authored-By: David Cramer <david@sentry.io>
@github-actions github-actions Bot added the risk: high PR risk score: high label Aug 26, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9885da8. Configure here.

Comment thread packages/junior/src/chat/sandbox/egress/session.ts Outdated
System runs with a delegated user subject must not share one user/broker
lease cache entry. Key those grants by subject user id so a later hop
cannot reuse another user's host-held credential.
@dcramer
dcramer merged commit e0014fe into main Aug 26, 2026
38 checks passed
@dcramer
dcramer deleted the ref/simplify-egress-installation-credentials branch August 26, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant